package com.example.paymentsystem.strategy.impl;

import com.example.paymentsystem.common.PaymentRequest;
import com.example.paymentsystem.common.PaymentResponse;
import com.example.paymentsystem.factory.AbstractPaymentFactory;
import com.example.paymentsystem.factory.AlipayPaymentFactory;
import com.example.paymentsystem.factory.product.AbstractPaymentProduct;
import com.example.paymentsystem.strategy.PaymentStrategy;

/**
 * @author YiYuan
 * @data 2025/6/25
 * @apoNote
 */
public class AlipayAppPaymentStrategy implements PaymentStrategy {

    private final AbstractPaymentFactory paymentFactory;

    public AlipayAppPaymentStrategy(AbstractPaymentFactory paymentFactory) {
        this.paymentFactory = paymentFactory;
    }

    @Override
    public PaymentResponse pay(PaymentRequest request) {

        System.out.println("Executing Alipay APP payment strategy...");
        AbstractPaymentProduct product = paymentFactory.createPaymentProduct("request.getPaymentType()");
        product.pay();

        PaymentResponse response = new PaymentResponse();
        response.setSuccess(true);
        response.setMessage("Alipay APP payment successful");

        return response;
    }
}
